<template>
  <el-container class="home-container">
    <!--    头部区-->
    <el-header>
      <div>
        <span>COM后台管理</span>
      </div>
      <div>
        <el-button type="info" @click="quit">退出</el-button>
      </div>
    </el-header>
    <!--    页面主体-->
    <el-container>
      <!--      侧边栏-->
      <Aside></Aside>
      <!--      main内容-->
      <el-main>
        <transition name="el-zoom-in-center">
        <router-view></router-view>
        </transition>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import Aside from '../components/Aside/Aside'
export default {
  components:{
    Aside,
  },
  data () {
    return {
    }
  },
  created() {
    if (window.localStorage.getItem('token')=== "") {
      this.$router.push('/login')
    }
  },
  methods: {
    quit(){
      localStorage.clear();
      this.$router.push('/login')
    }
  },

}
</script>

<style lang="less" scoped>
.home-container {
  height: 100%;
}

.el-header {
  background: #373d41;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-size: 20px;

  img {
    width: 8%;
  }

  > div {
    display: flex;
    align-items: center;

    span {
      margin-left: 15px;
    }
  }
}

.el-aside {
  background: #333744;
  .el-menu {
    border-right: none;
  }
}

.el-main {
  background: #eaedf2;
}

.toggle-button {
  background-color: #4A5064;
  color: #fff;
  font-size: 10px;
  line-height: 24px;
  text-align: center;
  letter-spacing: 0.2rem;
  cursor: pointer;
}
</style>
